<template>
    <div style="background-color:coral">
        <button @click="show=true">听听老爸和我说了什么？</button>
        <p v-show='show'>老爸说(接受父组件传递过来的数据)：{{toSon}}</p>
        <h3>子组件可以通过$emit向父组件传递数据</h3>
        <p v-show="show">那我就用成绩来告诉爸爸吧</p>
        <button @click="handle">反馈</button>
        爸爸又说<span :style="{fontSize:getWid}">棒！</span>
        爸爸又说{{receiveMsg}}
    </div>
</template>

<script>
export default{
    props:['toSon','wid'],
    data(){
        return{
            show:false,
            receiveMsg:''
        }
    },
    computed:{
        getWid(){
            return this.wid+'px'
        }
    },
    methods:{
    receiveMessage(message){
        this.receiveMsg=message
    },
    handle(){
        this.$emit('score',99)
    }
    }
}
</script>